/*

Copyright (C) 2007 Thomas Geiger (tom.geiger@gmail.com)

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

*/

/**
 * This header file defines a convenient interface for exchanging data
 * with Octave.
 */

#ifndef GTLS_H_
#define GTLS_H_

#include <sstream>
#include <string>

#include <octave/oct.h>
#include <octave/load-save.h>

using namespace std;


/**
 * Parse format of file from given string
 */
extern bool set_format(load_save_format& format, string& flag);

/**
 * Read octave values to from stream
 * Parameters:
 * - input, the stream with the input data
 * - format, the file format of the data
 * - vars, the resulting variables
 */
extern octave_value_list load_data(istream& input, load_save_format& format, const octave_value_list& vars);

/**
 * Save octave variables to a stream
 * Parameters:
 * - output, the target stream with the data to write
 * - format, the format of the data (oct, mat, xml, ...)
 * - vars, the variables to save
 */
extern void save_data(ostream& output, load_save_format& format, const octave_value_list& vars);


#endif /*GTLS_H_*/
